package cn.kimming.wms.web.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;

import cn.kimming.wms.anno.RequiredPermission;
import cn.kimming.wms.query.ProductStockQueryObject;
import cn.kimming.wms.service.IBrandService;
import cn.kimming.wms.service.IDepotService;
import cn.kimming.wms.service.IProductStockService;
import lombok.Getter;

@Controller("productStockAction")
@Scope("prototype")
public class ProductStockAction extends BaseAction{

	private static final long serialVersionUID = 1170439162886511074L;

	@Autowired
	private IProductStockService productStockService;
	@Autowired
	private IDepotService depotService;
	@Autowired
	private IBrandService brandService;


	@Getter
	private ProductStockQueryObject qo = new ProductStockQueryObject();

	@Override
	@RequiredPermission("即时库存报表")
	public String execute() {
		try {
			ActionContext.getContext().put("objs", productStockService.query(qo));
			ActionContext.getContext().put("depots", depotService.list());
			ActionContext.getContext().put("brands", brandService.list());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return LIST;
	}

	
	
	
}
